<!DOCTYPE html>
<html lang="en">
<head>
	<include data="head.html">
	<import data="js/date.js">
	<title>{$title}</title>
	<style>
	#comment-list-div{min-height: 20px;}
	.comment-at{/*background-color: #eee;padding: 1px 3px;*/margin-right: 5px;/*border-radius: 3px;*/}
	</style>
</head>
<body data-menu="comments">
	<div class="container">
		<ul class="nav nav-tabs" role="tablist" id="comment-list-tabs">
			<if data="IS_AUTH">
				<li role="presentation">
					<a href="comments.html">所有({$commentCount['all']})</a>
				</li>
			</if>
			<li role="presentation" data="person">
				<a href="comments.html?user_id={@$_GET['user_id'] ?: me_id()}&tablist=person">{$person}的评论({$commentCount['person']})</a>
			</li>
			<if data="!empty($_GET['user_id']) || !empty($_GET['commentsTo'])">
				<li role="presentation" data="commentsTo">
					<a href="comments.html?tablist=commentsTo&commentsTo=true&user_id={@$_GET['user_id'] ?: me_id()}">回复{$person}的({$commentCount['to']})</a>
				</li>
			</if>
			<li role="presentation" data="unreviewed">
				<a href="comments.html?comment_status=0{@$_GET['user_id'] ? '&user_id='.$_GET['user_id'] :''}&tablist=unreviewed">未审核({$commentCount['unreviewed']})</a>
			</li>
			<if data="!empty($_GET['post_id'])">
				<li role="presentation" class="active">
					<a href="#">此文的评论({$commentCount['post']})</a>
				</li>
				<elseif data="!empty($_GET['comment_id'])">
					<li role="presentation" class="active">
						<a href="#">当前评论</a>
					</li>
				</elseif>
			</if>
		</ul>
		<div id="comment-list-div">
			<while data="get_multi_comment($arg)">
				<div class="media" data-id="{comment_id()}" data-user-id="{comment_user('id')}" data-status="{comment_status()}" data-user-email="{comment_user('email')}" data-comment-ip="{the_comment('ip')}">
					<div class="media-left">
						<div class="media-logo">
							<if data="comment_user('avatar')">
								<img src="{get_user_avatar(64, comment_user('avatar'))}" alt="用户头像">
								<else>
									<i class="glyphicon glyphicon-user media-icon"></i>
								</else>
							</if>
						</div>
					</div>
					<div class="media-body">
						<if data="empty($_GET['user_id']) || !empty($_GET['commentsTo'])">
							<h4 class="media-heading">
								{!$isMe = (comment_user('id') == ME_ID)}
								<if data="IS_AUTH">
									<a title="查看{$isMe ? '我' : '此人'}的评论" href="comments.html?user_id={comment_user('id')}&tablist=person">
										{comment_user('nickname') ?: comment_user('name')}
									</a>
									<else>
										{comment_user('nickname') ?: comment_user('name')}
									</else>
								</if>
							</h4>
						</if>
						<p class="media-content">
							<if data="empty($_GET['commentsTo']) && comment_parent()">
								{!$isMe = comment_parent('user_id') == ME_ID}
								{!$parent = comment_parent('user_nickname') ?: comment_parent('user_name')}
								<if data="IS_AUTH || $isMe">
									<a title="查看{$isMe ? '我' : '此人'}的评论" href="comments.html?user_id={comment_parent('user_id')}&tablist=person">
										<span class="comment-at">@{$isMe ? '我' : $parent}</span>
									</a>
									<else>
										<span class="comment-at">@{$parent}</span>
									</else>
								</if>
							</if>
							<span class="comment-content">{comment_content()}</span>
						</p>
						<p class="media-meta">
							<if data="empty($_GET['post_id'])">
								{date('Y-m-d', comment_time())} 发表于《<a title="查看该文章的评论" href="comments.html?post_id={comment_post('id')}">{comment_post('title')}</a>》
								<else>
									发表于 {date('Y-m-d', comment_time())}
								</else>
							</if>
						</p>
					</div>
				</div>
			</while>
		</div>
	</div>
	<div class="modal fade" id="comment-modal">
		<div class="modal-dialog">
			<form action="{site_url()}mod.php?comment::update" method="post">
				<input type="hidden" name="comment_ip" value="{get_client_ip()}">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
						<h4 class="modal-title">编辑评论</h4>
					</div>
					<div class="modal-body">
						<textarea class="form-control" name="comment_content" rows="3" required></textarea>
					</div>
					<div class="modal-footer">
						<button type="submit" class="btn btn-success">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="modal fade" id="comment-modal-blacklist">
		<div class="modal-dialog">
			<form action="{site_url()}mod.php?blacklist::add" method="post">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
						<h4 class="modal-title">屏蔽选项</h4>
					</div>
					<div class="modal-body">
						<div class="checkbox-inline">
							<label>
								<input type="checkbox" name="blacklist_uid" value=""> 用户 ID
							</label>
						</div>
						<div class="checkbox-inline">
							<label>
								<input type="checkbox" name="blacklist_email" value=""> 电子邮件
							</label>
						</div>
						<div class="checkbox-inline">
							<label>
								<input type="checkbox" name="blacklist_ip" value=""> IP 地址
							</label>
						</div>
					</div>
					<div class="modal-footer">
						<button type="submit" class="btn btn-success">提交</button>
						<button type="reset" class="btn btn-default" style="display:none">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<script>
		TOTAL = {_comment('total') ?: 0};
		PAGES = {_comment('pages') ?: 0};
		COMMENT_REVIEW = {config('comment.review') ?: 0}; //评论审核
	</script>
	<include data="foot.html">
</body>
</html>